<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>VCR4J - CPD Results</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            VCR4J
    
            </span>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2009-06-01
                      </div>
            <div class="xright">            <a href="">VCR4J</a>
            
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                             <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
            
            
      
            
      
            
      
            
      
            
      
            
      
              
            <li class="expanded">
                    <a href="project-reports.html">Project Reports</a>
                  <ul>
                  
    <li class="none">
              <strong>CPD Report</strong>
        </li>
                  
    <li class="none">
                    <a href="apidocs/index.html">JavaDocs</a>
          </li>
                  
    <li class="none">
                    <a href="pmd.html">PMD Report</a>
          </li>
                  
    <li class="none">
                    <a href="xref/index.html">Source Xref</a>
          </li>
                  
    <li class="none">
                    <a href="taglist.html">Tag List</a>
          </li>
                  
    <li class="none">
                    <a href="testapidocs/index.html">Test JavaDocs</a>
          </li>
                  
    <li class="none">
                    <a href="xref-test/index.html">Test Source Xref</a>
          </li>
              </ul>
        </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>CPD Results</h2>
<p>The following document contains the results of PMD's  <a href="http://pmd.sourceforge.net/cpd.html" class="externalLink">CPD</a> 4.2.2.</p>
</div>
<div class="section"><h2>Duplications</h2>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/mbari/vcr/udp01/VCRConnectionPanel.java</td>
<td><a href="./xref/org/mbari/vcr/udp01/VCRConnectionPanel.html#123">123</a></td>
</tr>
<tr class="a"><td>org/mbari/vcr/udp02/VCRConnectionPanel.java</td>
<td><a href="./xref/org/mbari/vcr/udp02/VCRConnectionPanel.html#122">122</a></td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>            final IVCR vcrUdp = new VCR(Integer.parseInt(getPortField().getText()));

            vcr = new AnnotationMonitoringVCR(vcrUdp);
        }
        catch (Exception e) {
            if (log.isWarnEnabled()) {
                log.warn(&quot;Failed to connect to VCR on &quot; + getHostField().getText(), e);
            }

            vcr = new VCRAdapter();
        }

        return vcr;
    }

    public String getVcrPanelName() {
        return VCR_PANEL_NAME;
    }

    /**
     * This method initializes this
     *
     */
    private void initialize() {
        GridBagConstraints gridBagConstraints21 = new GridBagConstraints();

        gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints21.gridy = 1;
        gridBagConstraints21.weightx = 1.0;
        gridBagConstraints21.insets = new java.awt.Insets(5, 5, 5, 5);
        gridBagConstraints21.gridx = 1;

        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();

        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.insets = new java.awt.Insets(5, 5, 5, 5);
        gridBagConstraints1.gridy = 1;
        portLabel = new JLabel();
        portLabel.setText(&quot;Port:&quot;);

        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();

        gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints2.gridy = 0;
        gridBagConstraints2.weightx = 1.0;
        gridBagConstraints2.insets = new java.awt.Insets(5, 5, 5, 5);
        gridBagConstraints2.gridx = 1;

        GridBagConstraints gridBagConstraints = new GridBagConstraints();

        gridBagConstraints.gridx = 0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        gridBagConstraints.gridy = 0;
        hostLabel = new JLabel();
        hostLabel.setText(&quot;Host:&quot;);
        this.setLayout(new GridBagLayout());
        this.setPreferredSize(new java.awt.Dimension(250, 60));
        this.add(hostLabel, gridBagConstraints);
        this.add(getHostField(), gridBagConstraints2);
        this.add(portLabel, gridBagConstraints1);
        this.add(getPortField(), gridBagConstraints21);

    }
}</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/mbari/vcr/udp01/VCR.java</td>
<td><a href="./xref/org/mbari/vcr/udp01/VCR.html#97">97</a></td>
</tr>
<tr class="a"><td>org/mbari/vcr/udp02/VCR.java</td>
<td><a href="./xref/org/mbari/vcr/udp02/VCR.html#77">77</a></td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>        requestTimePacket = new DatagramPacket(REQUEST_TIME, REQUEST_TIME.length, inetAddress, port);
        requestTimeCode();
    }

    @Override
    public void disconnect() {

        if (!socket.isClosed()) {
            socket.close();
        }

        getVcrTimecode().getTimecode().setTime(0, 0, 0, 0);
        ((VCRState) getVcrState()).setPlaying(false);
        ((VCRState) getVcrState()).setConnected(false);
        super.disconnect();
    }

    @Override
    protected void finalize() throws Throwable {
        if (!socket.isClosed()) {
            socket.close();
        }

        super.finalize();
    }

    /**
     * Returns a name for this connection
     */
    @Override
    public String getConnectionName() {
        DatagramSocket s = null;
        String connectionName = &quot;Not connected&quot;;

        try {
            s = getSocket();
            connectionName = &quot;UDP Broadcast:&quot; + s.getPort();</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/mbari/vcr/udp01/VCRState.java</td>
<td><a href="./xref/org/mbari/vcr/udp01/VCRState.html#47">47</a></td>
</tr>
<tr class="a"><td>org/mbari/vcr/udp02/VCRState.java</td>
<td><a href="./xref/org/mbari/vcr/udp02/VCRState.html#47">47</a></td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>    public VCRState() {}

    @Override
    public boolean isConnected() {
        return connected;
    }

    @Override
    public boolean isPlaying() {
        return playing;
    }

    @Override
    public boolean isRecording() {
        return recording;
    }

    @Override
    public boolean isStill() {
        return false;
    }

    @Override
    public boolean isStopped() {
        return false;
    }

    @Override
    protected void notifyObservers() {
        super.notifyObservers();
    }

    /**
         * @param connected  the connected to set
         * @uml.property  name=&quot;connected&quot;
         */
    protected void setConnected(boolean connected) {
        this.connected = connected;
        this.playing = connected;
        this.recording = connected;
        notifyObservers();
    }

    /**
         * @param playing  the playing to set
         * @uml.property  name=&quot;playing&quot;
         */
    protected void setPlaying(boolean playing) {
        this.playing = playing;
        notifyObservers();
    }

    /**
         * @param recording  the recording to set
         * @uml.property  name=&quot;recording&quot;
         */
    public void setRecording(boolean recording) {
        this.recording = recording;
        notifyObservers();
    }
}</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
<p><table class="bodyTable"><tr class="a"><th>File</th>
<th>Line</th>
</tr>
<tr class="b"><td>org/mbari/vcr/udp01/VCR.java</td>
<td><a href="./xref/org/mbari/vcr/udp01/VCR.html#214">214</a></td>
</tr>
<tr class="a"><td>org/mbari/vcr/udp02/VCR.java</td>
<td><a href="./xref/org/mbari/vcr/udp02/VCR.html#261">261</a></td>
</tr>
<tr class="b"><td colspan='2'><div class="source"><pre>        }
        catch (Exception e) {

            // response will be null
            if (log.isErrorEnabled()) {
                log.error(&quot;UDP connection failed.&quot;, e);
            }
        }

        /*
         * Parse the response as an ASCII string
         */
        String result = null;

        try {
            result = new String(response, &quot;ASCII&quot;);
        }
        catch (UnsupportedEncodingException e) {
            try {

                // Try a different encoding
                result = new String(response, &quot;8859_1&quot;);
            }
            catch (UnsupportedEncodingException ex) {

                // result = null
                if (log.isErrorEnabled()) {
                    log.error(&quot;Timecode over UDP is using an unknown encoding&quot;);
                }
            }
        }
        catch (Exception e) {
            if (log.isErrorEnabled()) {
                log.error(&quot;Unable to get a valid response from &quot; + getConnectionName());
            }
        }

        if (log.isDebugEnabled()) {
            log.debug(&quot;Received Response: '&quot; + result + &quot;'&quot;);
        }</pre>
</div>
</td></tr>
<table class="bodyTable"></p>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2009
    
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
